import os

cwd                       = os.getcwd()
current_app               = os.path.join(cwd,'applications',request.application)
plugin_name               = 'plugin_admin_font'
configuration_file_path   = os.path.join(current_app,'models','0000_config_file_fonts.py')
configuration_file_global = 'configuration_file_plugin_admin_font_installed'

if '_fontface' in request.vars:
    session._fontface = _fontface = request.vars._fontface
    session._fontfamily = _fontfamily = request.vars._fontfamily

if '_plugin_admin_installed' in globals():
    '''
    make sure the plugin_admin is installed
    '''
    _ensure_configuration_file(configuration_file_path)
else:
    print('you need to install plugin_admin')

# add a global to the config file telling us plugin_admin_font is installed.
_ensure_configuration_file_append_global(configuration_file_path, configuration_file_global, plugin_name)

configuration_file_global = 'plugin_admin_font_installed'
_ensure_configuration_file_append_global(configuration_file_path, configuration_file_global, plugin_name)


def _ensure_new_font(configuration_file_global, plugin_name):
    '''
    _ensure_font gets called from font installer
    '''
    print ('########################################################')
    print ('# configuration_file_global: %s') % configuration_file_global
    print ('# plugin_name: %s') % plugin_name
    _ensure_configuration_file_append_global(configuration_file_path, configuration_file_global, plugin_name)
